<#include "../../ajaxPage.ftl" />
<#include "../../display.ftl" />
<table class="table table-datatable table-gray">
    <input type="hidden" id="selectCardId" name="cardId"/>
    <input type="hidden" id="selectCustomerName" name="customerName"/>
    <thead>
    <tr>

        <th>卡号</th>
        <th>客户姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>电话</th>
        <th>身份证</th>
        <th>地址</th>
    </tr>
    </thead>
    <tbody>
    <#if customersTable.rows??>
        <#list customersTable.rows as customer>
        <tr onclick="selectArow(this);">
            <td>${customer.cardId!''}</td>
            <td>${customer.customerName!''}</td>
            <td>${customer.age!''}</td>
            <td>
                <@display list=sexTypeList value="${customer.sex!''}"/>
            </td>
            <td>${customer.phone!''}</td>
            <td>${customer.staffId!''}</td>
            <td>${customer.address!''}</td>

        </tr>
        </#list>
    </#if>
    </tbody>
</table>
<#if customersTable??>
    <@page table=customersTable formId="search_customer_select" contentId="selectContent"/>
</#if>

<script>
    $(function () {
        $("table tbody tr").click(function () {
            $("table tbody tr").removeClass("active");
            $(this).addClass("active");
            var cardId = $(this).children("td:eq(0)").text();
            var customerName = $(this).children("td:eq(1)").text();
            if (cardId != "" && customerName != "") {
                $("#selectCardId").val(cardId);
                $("#selectCustomerName").val(customerName);
            }
        });
    });
</script>